﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Account_ManageRoles : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            ListBoxDataBind();
        }
    }
   
    protected void Insert_Role(object sender, EventArgs e)
    {
        Roles.CreateRole(RoleName.Text);
        ListBoxDataBind();
    }
    protected void ListBoxDataBind()
    {
        RolesList.DataSource = Roles.GetAllRoles();
        RolesList.DataBind();
    }
    protected void Delete_Role(object sender, EventArgs e)
    {
       
                Roles.DeleteRole(RolesList.SelectedItem.Text);
                  ListBoxDataBind();

    }



    protected void RolesList_SelectedIndexChanged1(object sender, EventArgs e)
    {
        
        ListOfUsers.DataSource = Roles.GetUsersInRole(RolesList.SelectedItem.Text);
        ListOfUsers.DataBind();
    }
}